package com.qf.day31_boot.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

//@Component
//@Aspect // 切面注解
public class MyAspect {

    @Pointcut("execution(* com.qf.day31_boot.controller..*.*(..))")
    public void mypointcut() {  }

    @Before("mypointcut()")
    public void before(){
        System.out.println("=========before=========");
    }

    @Around("mypointcut()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {

        System.out.println("----------around 前置----------");

        final Object result = pjp.proceed();

        System.out.println("----------around 后置----------");

        return result;

    }

    @After("mypointcut()")
    public void after(){
        System.out.println("=========after=========");
    }

}
